function changClassForOther() {	
	if(!(dataMtRight[R_OP_Run] || dataMtRight[R_OP_Edit])){//填报数据权限
		$("#m2").hide();$('#save').hide();
	}
	if(!dataMtRight[R_OP_Edit]){//填报数据修改权限
		$('#edit').hide();
		$("#saveEdit").hide();
	}
	
	if(!(dataListMtRight[R_OP_Run]|| dataListMtRight[R_OP_Edit])){//有运行和编辑的权限都显示数据列表查看链接
		$("#m3").hide();
	}

	var lastUrl = window.location.href.substr(window.location.href.lastIndexOf("/") + 1);
	if ($.browser.msie) {		
		if (lastUrl == "dataView.jsp" || lastUrl.substring(0, lastUrl.indexOf("?")) == "dataForView.jsp" 
			|| lastUrl.substring(0, lastUrl.indexOf("?")) == "dataForEdit.jsp") {
			$(".mainContent1").css("margin-top", "3px");			
			$(".mainContent").css("margin-top", "0px");		
			if(parseInt($.browser.version)<8){
				//$(".top").css("margin-top", "20px");
			}else if(parseInt($.browser.version)>=8){	
				$(".top").css("margin-top", "20px");
			}
		}else if(lastUrl.substr(0,15)  == "dataListMgr.jsp" ){		
			$(".top").css("margin-top", "20px");
			$(".mainContent1").css("margin-top", "3px");
			$(".mainContent").css("margin-top", "-10px");
			$(".chart1").css("margin-bottom", "-7px");	
		}else if(lastUrl.substr(0,5)=='chart'){
			$(".top").css("margin-top", "20px");
			$(".mainContent1").css("margin-top", "3px");
			$(".mainContent").css("margin-top", "-10px");
			$(".chart1").css("margin-bottom", "-7px");	
		}else{
			$(".top").css("margin-top", "20px");
			$(".mainContent1").css("margin-top", "3px");
			$(".chart1").css("margin-bottom", "-7px");	
			$(".mainContent").css("margin-top", "-10px");
		}	
		if(parseInt($.browser.version)<8){
			$(".btn").css("margin-top", "-30px");	
		}else if(parseInt($.browser.version)>=8){			
			$(".btn").css("margin-top", "-10px");
		}
		$("#bottomDivCenter").css("margin-top", "-10px");
		$("#bottomDivLast").css("margin-top", "-10px");
	}else {		
		//$(".centerBottom").css("margin-top", "0px");	
		//$(".centerDiv").css("margin-top", "3px");	
		$(".top").css("margin-top", "20px");
		$(".mainContent1").css("margin-top", "3px");		
		if($.browser.opera){
			$(".mainContent1").css("margin-top", "5px");	
			/*if(lastUrl == "dataListMgr.jsp" || lastUrl == "dataListMgr.jsp#"){			
				$(".chart1").css("margin-bottom", "-10px");	
				$(".centerDiv").css("margin-top", "6px");	
			}*/
		}
	}	
	
}
changClassForOther();

//提示信息，弹出一个div,根据传进来的html的内容动态显示
function showDiv(isForbid,html) {
	var div = $("#showmessage");	
	var height = (document.documentElement.clientHeight - div.height()) / 2 -100;
	var width = (document.documentElement.clientWidth - div.width()) / 2 ;	
	
	if($.browser.msie ){
		var lastUrl = window.location.href.substr(window.location.href.lastIndexOf("/") + 1);
		if(lastUrl.substr(0,15) == "dataListMgr.jsp" ){
			width=(window.screen.availWidth-div.width())/2;
			height=(window.screen.availHeight/2-div.height());
		}
	}
	div.html(html).css( {left : width,top : height}).show();
	if(isForbid){
		var id = $('.img img[id^=save]').attr('id');
		if (id == null || id == undefined) {
			return;
		} else {
			$('.img img[id^=save]').attr('id', 'disabledImg');
		}
		div.delay(1500).fadeOut(500, function() {div.stop().html('').hide();$('.img img[id=disabledImg]').attr('id', id);	});
	}else{
		div.delay(1500).fadeOut(500, function() {div.stop().html('').hide();});	
	}	
}

function changeForImg() {
	var firstNum = "0";
	$("a > img").live( {
		mouseout : function() {
			var imgsrc = this.src;
			var num = imgsrc.substr(imgsrc.lastIndexOf(".gif") - 1, 1);
			if (firstNum == "0" && num == "1") {
				this.src = imgsrc.substring(0, imgsrc.lastIndexOf(".gif") - 1) + "0.gif";
			}
		},
		mouseover : function() {
			var imgsrc = this.src;
			var num = imgsrc.substr(imgsrc.lastIndexOf(".gif") - 1, 1);
			firstNum = num;
			if (num == "0") {
				this.src = imgsrc.substring(0, imgsrc.lastIndexOf(".gif") - 1) + "1.gif";
			}
		}
	});
}
changeForImg();

function radioClick(e){
	  var radio = $(e.target);
	  var tag=radio.attr('name');
		if (radio.attr("tag") == 1) {
			radio.attr("checked", false);
			radio.attr("tag", 0);
		} else {
			$(":radio[name=" + tag + "]").attr('tag', '0').attr('checked',
					false);
			radio.attr("checked", true);
			radio.attr("tag", 1);
		}
		if (radio.attr('name') == 'P112') {
			if($(":radio[name=P112][checked]").length<=0){
				$("span[id='P112']").html("<font style='color:red;font-size:12px;'>&nbsp;&nbsp;&nbsp;请选择供体来源！</font>");
			}
			if ( radio.attr('value') == '2') {
				if(radio.attr("checked") ){
					$("span[id='P113']").css('visibility', 'visible');
				}else{
					$(":radio[name='P113']").attr('checked',false).attr('tag','0');
					$("span[id='P113']").css('visibility', 'hidden');
				}					
			} else if(radio.attr('value') == '1'){				
					if(radio.attr('checked')){						
						$(":radio[name='P113']").attr('checked',false).attr('tag','0');
						$("span[id='P113']").css('visibility', 'hidden');
						$("span[id='P112']").html("&nbsp;&nbsp;&nbsp;");
					}
			}
		} else if(radio.attr('name') == 'P113'){
			if($(":radio[name=P113][checked]").length<=0){
				$("span[id='P112']").html("<font style='color:red;font-size:12px;'>&nbsp;&nbsp;&nbsp;请选择尸体来源类型！</font>");
			}else{
				$("span[id='P112']").html("&nbsp;&nbsp;&nbsp;");
			}
		}else if (radio.attr('name') == 'P118') {
			if ( radio.attr('value') == '1') {
				if(	radio.attr("checked") ){
					$("#P119").show();
				}else{
					$("select[name='P119']").val('-1');
						$("#P119").hide();
				}
			} else if ( radio.attr('value') == '2') {
				$("select[name='P119']").val('-1');
				$("#P119").hide();
			}
			if($(":radio[name=P118][checked]").length>0){
				$("#P118Span").html("&nbsp;");
			}else{
				$("#P118Span").html("<font style='color:red;font-size:12px;'>请选择制剂免疫方案！</font>");
			}
		}else if(radio.attr('name') == 'P105' ){
			if($(":radio[name=P105][checked]").length>0){
				$("#P105Span").html("&nbsp;");
			}else{
				$("#P105Span").html("<font style='color:red;font-size:12px;'>请选择移植类型！</font>");
			}
		}
  }
function validPatientName(e){
	  var obj =$(e.target);
	  var labelName=obj.attr('id');
	  var value=obj.val();
	  	var flag=true;
    		if(value !=''){
    		  	//只能输入中文或英文
    		  
    			if(value.replace(/[^\a-zA-Z\u4E00-\u9FA5]/g,'').length==0 || (value.replace(/[^\u4E00-\u9FA5]/g,'').length != value.length && value.replace(/[^\u4E00-\u9FA5]/g,'').length !=0)||
    		  		(value.replace(/[^\a-zA-Z]/g,'').length != value.length && value.replace(/[^\a-zA-Z]/g,'').length !=0) ){
    		  		$("#"+labelName+"_label").html("<font style='color:red;font-size:12px;'>姓名只能为纯中文或纯英文</font>")
    		  		flag=false;
    		  		if(labelName =='P106'){
    		  			globalFlag[0]=false;
    		  		}else{
    		  			globalFlag[1]=false;
    		  		}
    		  		obj.css('border-color','#FC1818');
    		  	}else{
    		  		if(value.length !=value.replace(/[^\u4E00-\u9FA5]/g,'').length ){//如果不是全中文
	    		  		if (value.replace(/[^\u4E00-\u9FA5]/g,'').length ==0){
	    		  				value=value.replace(/[^\a-zA-Z]/g,''); //那只能是全英文
	    		  		}else {
	    		  			$("#"+labelName+"_label").html("<font style='color:red;font-size:12px;'>姓名只能为纯中文或纯英文</font>");
	    		  			if(/^[a-zA-Z]/.test(value)){
	    		  					value=value.replace(/[^\a-zA-Z]/g,''); //那只能是全英文
	    		  			}else if(/^[\u4E00-\u9FA5]/.test(value)){
	    		  					value=value.replace(/[^\u4E00-\u9FA5]/g,'');
	    		  			}
	    		  		}
    				}
	    			obj.css('border-color','');
	    			$("#"+labelName+"_label").html('');
	    			flag=true;
	    			if(labelName =='P106'){
    		  			globalFlag[0]=true;
    		  		}else{
    		  			globalFlag[1]=true;
    		  		}
    			}
    		}else{
    			obj.css('border-color','');
    			$("#"+labelName+"_label").html('');
	    		flag=true;
	    		if(labelName =='P106'){
    		  			globalFlag[0]=true;
    		  		}else{
    		  			globalFlag[1]=true;
    		  		}
    		}
    		 return flag;
  }
function logout() {
	var flag = confirm("你确定要退出吗？");
	if (flag) {
		var logoutUrl = buildServUrl('doLoginAction') + '?Action=doLogout'; //buildServUrl('doLoginAction')+'?Action=doLogout';		alert(logoutUrl);
		$.ajax( {
			url : logoutUrl,
			cache : false,
			success : function(sRtn) {
				if (sRtn == '1') {
					window.location.replace(basepath + 'login.jsp');
				} else {
					window.location.replace(basepath + 'login.jsp');
				}
			},
			error : function() {
				window.location.replace(basepath + 'login.jsp');
			}
		});
	}
}

//chart 
//Apply the theme On document ready, call visualize on the datatable.
function createTheme() {
	Highcharts.theme = {
		colors : [ '#D92940', '#058DC7', '#50B432', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4' ],
		chart : {
			borderWidth : 0,
			plotBackgroundColor : 'rgba(255, 255, 255, .9)',
			plotShadow : true,
			plotBorderWidth : 1
		},
		title : {
			style : {
				color : '#000',
				font : 'bold 16px "Trebuchet MS", Verdana, sans-serif'
			}
		},
		subtitle : {
			style : {
				color : '#666666',
				font : 'bold 12px "Trebuchet MS", Verdana, sans-serif'
			}
		},
		xAxis : {
			gridLineWidth : 1,
			lineColor : '#000',
			tickColor : '#000',
			labels : {
				style : {
					color : '#000',
					font : '11px Trebuchet MS, Verdana, sans-serif'
				}
			},
			title : {
				style : {
					color : '#333',
					fontWeight : 'bold',
					fontSize : '12px',
					fontFamily : 'Trebuchet MS, Verdana, sans-serif'

				}
			}
		},
		yAxis : {
			minorTickInterval : 'auto',
			lineColor : '#000',
			lineWidth : 1,
			tickWidth : 1,
			tickColor : '#000',
			labels : {
				style : {
					color : '#000',
					font : '11px Trebuchet MS, Verdana, sans-serif'
				}
			},
			title : {
				style : {
					color : '#333',
					fontWeight : 'bold',
					fontSize : '12px',
					fontFamily : 'Trebuchet MS, Verdana, sans-serif'
				}
			}
		},
		legend : {
			itemStyle : {
				font : '9pt Trebuchet MS, Verdana, sans-serif',
				color : 'black'

			},
			itemHoverStyle : {
				color : '#039'
			},
			itemHiddenStyle : {
				color : 'gray'
			}
		},
		labels : {
			style : {
				color : '#99b'
			}
		}
	};

	var highchartsOptions = Highcharts.setOptions(Highcharts.theme);
}

function createOptionsSeriesType(containerDiv, seriesType) {
	var options = null;
	if(null ==containerDiv || ''==containerDiv || undefined == containerDiv){
		containerDiv='container';
	}
	if (seriesType == "column") {
		options = {
			chart : {
				renderTo : containerDiv,
				defaultSeriesType : 'column',
				width : 780
			},
			title : {
				text : ''
			},
			xAxis : {
				title : {
					text : ''
				}
			},
			yAxis : {
				title : {
					text : ''
				}
			},
			tooltip : {
				formatter : function() {
					return this.series.name + "<br/>" + this.x + "  " + this.y;
				}
			},
			series : []
		};
	} else if (seriesType == 'stackedColumn') {
		options = {
			chart : {
				renderTo : containerDiv,
				defaultSeriesType : 'column',
				width : 780
			},
			title : {
				text : ''
			},
			xAxis : {
				categories : [],
				title : {
					text : ''
				}
			},
			yAxis : {
				min : 0,
				title : {
					text : ''
				},
				stackLabels : {
					enabled : false,
					style : {
						fontWeight : 'bold',
						color : (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
					}
				}
			},
			legend : {
				align : 'center',
				x : 0,
				verticalAlign : 'bottom',
				y : 0,
				floating : false,
				backgroundColor : (Highcharts.theme && Highcharts.theme.legendBackgroundColorSolid) || 'white',
				borderColor : '#CCC',
				borderWidth : 1,
				shadow : false
			},
			tooltip : {
				formatter : function() {
					return '<b>' + this.x + '</b><br/>' + this.series.name + ': ' + this.y + '<br/>' + 'Total: ' + this.point.stackTotal;
				}
			},
			plotOptions : {
				column : {
					stacking : 'normal',
					dataLabels : {
						enabled : false,
						color : (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white'
					}
				}
			},
			series : []
		};
	} else if (seriesType == 'spline') {
		options = {
			chart : {
				renderTo : containerDiv,
				defaultSeriesType : 'spline',
				width : 780
			},
			title : {
				text : ''
			},
			subtitle : {
				text : ''
			},
			xAxis : {
				categories : [],
				title : {
					text : ''
				}
			},
			yAxis : {
				title : {
					text : ''
				},
				labels : {
					formatter : function() {
						return this.value + ''
					}
				},
				min : 0

			},
			tooltip : {
				crosshairs : true,
				shared : true
			},
			plotOptions : {
				spline : {
					marker : {
						radius : 4,
						lineColor : '#666666',
						lineWidth : 1
					}
				}
			},
			series : []
		};
	} else if (seriesType == 'splinePercent') {
		options = {
			chart : {
				renderTo : containerDiv,
				defaultSeriesType : 'spline',
				width : 780
			},
			title : {
				text : ''
			},
			xAxis : {
				categories : [],
				title : {
					text : ''
				}
			},
			yAxis : {
				min : 0,
				title : {
					text : ''
				}
			},
			tooltip : {
				formatter : function() {
					return '' + this.series.name + ': ' + this.y + ' (' + Math.round(this.percentage) + '%)';
				}
			},
			plotOptions : {
				spline : {
					stacking : 'percent'
				}
			},
			series : []
		};
	} else if (seriesType == 'columnPercent') {
		options = {
			chart : {
				renderTo : containerDiv,
				defaultSeriesType : 'line',
				width : 780
			},
			title : {
				text : ''
			},
			subtitle : {
				text : ''
			},
			xAxis : {
				categories : [],
				title : {
					text : ''
				}
			},
			yAxis : {
				title : {
					text : ''
				},
				labels : {
					formatter : function() {
						return this.value + ''
					}
				},
				min : 0
			},
			tooltip : {
				formatter : function() {
					return '' + this.series.name + ': ' + this.y + '%';
				}
			},
			plotOptions : {
				line : {
					marker : {
						radius : 4,
						lineColor : '#666666',
						lineWidth : 1
					}
				}
			},
			series : []
		};
	} else {
		//column-stacked-and-grouped.
		if (seriesType == "stacked_Grouped_column") {
			options = {
				chart : {
					renderTo : containerDiv,
					defaultSeriesType : 'column',
					width : 780
				},
				title : {
					text : ''
				},
				xAxis : {
					categories : [],
					title : {
						text : ''
					}
				},
				yAxis : {
					min : 0,
					title : {
						text : ''
					},
					stackLabels : {
						enabled : true,
						style : {
							fontWeight : 'bold',
							color : (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
						}
					}
				},
				legend : {
					align : 'center',
					x : 0,
					verticalAlign : 'bottom',
					y : 0,
					floating : false,
					backgroundColor : (Highcharts.theme && Highcharts.theme.legendBackgroundColorSolid) || 'white',
					borderColor : '#CCC',
					borderWidth : 1,
					shadow : false
				},
				tooltip : {
					formatter : function() {
						return '<b>' + this.x + '</b><br/>' + this.series.name + ': ' + this.y + '<br/>' + 'Total: ' + this.point.stackTotal;
					}
				},
				plotOptions : {
					column : {
						stacking : 'normal',
						dataLabels : {
							enabled : true,
							color : (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white'
						}
					}
				},
				series : []
			};
		}
	}	
	return options;
}

function initLeftMemu() {
	var leftBox = $("#leftBox");
	var yearTime = new Date().getFullYear();
	for ( var i = 1; i <= 2; i++) {
			var tx = "";
			if (i == 1) {
				tx = "LTx";
			} else if (i == 2) {
				tx = "KTx";
			}
			leftBox.append("<div><a align='center' class='minA' href='chartForTxYearStat.jsp?startYear=2007" + "&endYear=" + yearTime + "&tx=" + tx + "&title=" + tx
					+ "_Number_Stat._by_Year&type=stackedColumn' >" + tx + " No. by Year</a></div>");
	}
	//leftBox.append('<div><hr width="120" size="1"></div>');
	for(var year=yearTime;year>=yearTime-1;year--){
		var startYear = year - 1;
		leftBox.append('<div><hr width="120" align="left" size="1"></div>');
		for ( var i = 1; i <= 2; i++) {
			var tx = "";
			if (i == 1) {
				tx = "LTx";
			} else if (i == 2) {
				tx = "KTx";
			}
			leftBox.append("<div><a align='center' class='minA' href='chartForTx.jsp?startYear=" + startYear + "&endYear=" + year + "&tx=" + tx + "&title=" + year + "_" + tx
					+ "_Number_Stat._by_Month&type=column' >" + year + " " + tx + " (M)</a></div>");
		}
		for ( var i = 1; i <= 2; i++) {
			var tx = "";
			if (i == 1) {
				tx = "LTx";
			} else if (i == 2) {
				tx = "KTx";
			}
			leftBox.append("<div><a align='center' class='minA' href='chartForTxDonor.jsp?startYear=" + year + "&endYear=" + year + "&tx=" + tx + "&title=" + year + "_" + tx
					+ "_Number_Stat._by_Month_Donor&type=stackedColumn'>" + year + " " + tx + " Donor (M)</a></div>");
		}
		for ( var i = 1; i <= 2; i++) {
			var tx = "";
			if (i == 1) {
				tx = "LTx";
			} else if (i == 2) {
				tx = "KTx";
			}
			leftBox.append("<div><a align='center' class='minA' href='chartForTxCNIs.jsp?startYear=" + year + "&endYear=" + year + "&tx=" + tx + "&title=" + year + "_" + tx
					+ "_CNIs_Case_Share_by_Month&type=stackedColumn'>" + year + " " + tx + " CNIs (M)</a></div>");
		}
		for ( var i = 1; i <= 2; i++) {
			var tx = "";
			if (i == 1) {
				tx = "LTx";
			} else if (i == 2) {
				tx = "KTx";
			}
			leftBox.append("<div><a align='center' class='minA' href='chartForTxMed.jsp?startYear=" + startYear + "&endYear=" + year + "&tx=" + tx + "&med=PRG&title=" + year + "_"
					+ tx + "_PRG_Share_by_Month&type=columnPercent'>" + year + " " + tx + " PRG (M)</a></div>");
			leftBox.append("<div><a align='center' class='minA' href='chartForTxMed.jsp?startYear=" + startYear + "&endYear=" + year + "&tx=" + tx + "&med=TAC&title=" + year + "_"
					+ tx + "_TAC_Share_by_Month&type=columnPercent'>" + year + " " + tx + " TAC(G) (M)</a></div>");
			leftBox.append("<div><a align='center' class='minA' href='chartForTxMed.jsp?startYear=" + startYear + "&endYear=" + year + "&tx=" + tx + "&med=CsA&title=" + year + "_"
					+ tx + "_CsA_Share_by_Month&type=columnPercent'>" + year + " " + tx + " CsA (M)</a></div>");
		}
	}
}
function getUrlData() {
	var href = window.location.href;
	if (href.indexOf('?') == -1) {
		href = $("a[class='minA']").first()[0].href;
	}
	var paras = href.substr(href.indexOf('?')).substr(1).split("&");
	var data = "";
	$("a[class='minA']").each(function(i, n) {
		if (n.href == href) {
			n.style.color = "red";
			return false;
		}
	});
	for ( var i = 0; i < paras.length; i++) {
		data += "'" + paras[i].split("=")[0] + "':'" + paras[i].split("=")[1] + "',";
	}
	return eval("({" + data.substring(0, data.length - 1) + "})");
}

//向服务器请求数据
function getData(para, action) {
	var msg = "";
	$.ajax( {
		url : getActionUrl(action),
		type : "POST",
		dataType : 'json',
		async : false,
		data : para,
		success : function(jd) {
			msg = jd;
			$("#chartContainer").append("<div ><div  id='container' style='width: 780px; margin: 0 auto;'></div><div id='dataAnnualContrastDiv'  class='dataDivAndChartDiv'></div><br/><div id='invalidTableDiv'  class='dataDivAndChartDiv' ></div><br/></div>");
		},
		error : function() {
			alert('加载数据失败，请稍后再试！');
		}
	});
	return msg;
}

//生成统计图
function createChart(options) {
	chart = new Highcharts.Chart(options);//将此格式的options作为参数传给highcharts的Chart方法来生成chart实例
}
function createAnnualContrastTable(xAxis, series, showPercent, valid,validTableDiv) {
	$("#"+validTableDiv).append('<table class="mintable" align="left"  id="'+validTableDiv+'Table" width="780px" border="1" ></table><br/><br/>');
	if($.browser.msie){		
		$("#"+validTableDiv).append("</br>");
	}
	var thead = "<th></th>";

	for ( var x = 0; x < xAxis.length; x++) {
		thead += "<th>" + xAxis[x] + "</th>";
	}

	$("#"+validTableDiv+"Table").append("<tr>" + thead + "<th>Total</th></tr>");
	if (showPercent) {
		for ( var j = series.length - 1; j >= 0; j--) {
			if (j != series.length - 1) {
				var nextTr = "<th> VS " + series[j].name + "</th>";
				for ( var i = 0; i < xAxis.length; i++) {
					if (i < series[j].data.length) {
						nextTr += "<td>" + leftTwoDecIgnoreZero(series[series.length - 1].data[i] / series[j].data[i] * 100) + "</td>";
					} else {
						nextTr += "<td></td>";
					}
				}
			}
		}
		//计算与上一年度同比增长的情况
		var total1 = 0;
		var total2 = 0;
		for ( var k = 0; k < valid[valid.length - 1].data.length; k++) {
			for ( var n = 0; n < valid[valid.length - 1].data[k].data.length; n++) {
				total1 += valid[valid.length - 1].data[k].data[n];
			}
		}
		for ( var k = 0; k < valid[0].data.length; k++) {
			for ( var n = 0; n < valid[0].data[k].data.length && n < valid[valid.length - 1].data[0].data.length; n++) {
				total2 += valid[0].data[k].data[n];
			}
		}

		$("#"+validTableDiv+"Table").append("<tr>" + nextTr + "<td>" + leftTwoDecIgnoreZero(1.0 * total1 / total2 * 100) + "</td></tr>");
	}

	for ( var j =0 ; j<= series.length - 1; j++) {
		var nextTr = "<th> " + series[j].name + "</th>";
		var totalCount = 0;
		for ( var i = 0; i < xAxis.length; i++) {
			if (i < series[j].data.length) {
				if (j != series.length - 1) {
					nextTr += "<td>" + ((series[j].data[i]=='null' ||series[j].data[i]==null)?'':series[j].data[i]) + "</td>";
				} else {
					nextTr += "<td>" + ((series[j].data[i]=='null' ||series[j].data[i]==null)?'':series[j].data[i]) + "</td>";
				}
				totalCount += series[j].data[i];
			} else {
				nextTr += "<td></td>";
			}
		}
		nextTr += "<th>" + totalCount + "</th>";
		$("#"+validTableDiv+"Table").append("<tr>" + nextTr + "</tr>");
	}
	if (!showPercent) {
		var vlignAllCount = "";
		for ( var i = 0; i < xAxis.length; i++) {
			var vlignCount = 0;
			var isEnd = false,isNull=false;
			for ( var j = 0; j < series.length; j++) {
				if (i < series[j].data.length) {
					if(series[j].data[i]==null){
						isNull=true;
						break;
					}
					vlignCount += series[j].data[i];
				} else {
					isEnd = true;
					break;
				}
			}
			vlignAllCount += (isEnd ? "" : ( isNull ? '' : vlignCount)) + ",";
		}
		vlignAllCount = vlignAllCount.substr(0, vlignAllCount.length - 1).split(",");
		var totalVlign = "<tr><th>Total</th>";
		var total = 0;
		for ( var v = 0; v < xAxis.length; v++) {
			totalVlign += "<th>" + (vlignAllCount[v]=='' ?"":vlignAllCount[v]) + "</th>";
			total += parseInt(vlignAllCount[v] == '' ? 0 : vlignAllCount[v]);
		}
		$("#"+validTableDiv+"Table").append(totalVlign + "<th>" + total + "</th></tr>");
	}
}

//剔除数据列表
function createInValidTable(msgInvalid,invalidTableDiv) {
	var invalidDiv = $("#"+invalidTableDiv);
	for ( var k = 0; k < msgInvalid.length; k++) {	
		var invalid = msgInvalid[k];
		invalidDiv.append("<table class='mintable' border='1' align='left' id='"+invalidTableDiv+"Table" + k + "' width='780px' ></table><br/><br/><br/>");
		$("#"+invalidTableDiv+"Table" + k).append("<tr><th>数据情况</th><th>数量(例)</th><th>占选取数据比例(%)</th><th>涉及中心数(家)</th><th>处理结果</th></tr>");
		var total = invalid[0].number1;
		for ( var i = 0; i < invalid.length; i++) {
			var tr = "<tr><th>" + invalid[i].label + "</th><td>" + invalid[i].number1 + "</td><td>" + leftDecIgnoreZeroWithPercentAndNoRed(invalid[i].number1, total,2) + "</td>" + "<td>"
					+ invalid[i].number2 + "</td><td>" + invalid[i].operator + "</td></tr>";
			$("#"+invalidTableDiv+"Table" + k).append(tr);
		}
	}
}
function getNameByValue(value) {
	if (value == 1) {
		return "LTx";
	} else if (value == 2) {
		return "KTx";
	} else {
		return "";
	}
}
function trimWithChar(str, chars) {
	for ( var i = 0; i < str.length; i++) {
		if (str[i] == chars) {
			str = str.substring(0, i) + str.substring(i + 1);
		}
	}
	return str;
}
function replaceWithChar(str, charOld, newStr) {
	return (""+str).replace(/_/g, " ");
	/*
	 str=str.replace(/\(/g, "(").replace(/\)/g, ")");
	var i=0;
	while(i<str.length){
		if(str[i]==charOld){
			str=str.substring(0,i)+newStr+str.substring(i+1);
			i=i+newStr.length;
		}else{
			i++;
		}
	}
	return str;*/
}
function trimSingleQuotes(str) {
	return trimWithChar(str, "'");
}
function replaceWithSingleQuotes(str){
	return (""+str).replace(/'/g, "");
}
function leftTwoDec(x) {
	return Math.round(x * 100) / 100;
}
//显示百分数，无穷或小于0或非数字则不显示
function leftTwoDecIgnoreZero(x) {
	var f = Math.round(x * 100) / 100;
	return (f >= 0 && (f != "Infinity") && !f.NaN) ? (f < 100 ? '<font color="red">' + f + "%" : f + "%") : '';
}
//在括号内显示百分数
function leftTwoDecIgnoreZeroWithBracket(x) {
	var f = Math.round(x * 100) / 100;
	return (f >= 0 && (f != "Infinity") && !f.NaN) ? (f < 100 ? '<font color="red">(' + f + "%)" : "(" + f + "%)") : '';
}
function leftDec(x,y,n) {
	if(y==0){
		return "'null'";
	}
	return Math.round(1.0*x/y * Math.pow(10,n));
}
//显示百分数，无穷或小于0或非数字则不显示
function leftDecIgnoreZeroWithPercent(x,y,n) {
	if(y==0){
		return '';
	}
	var f = Math.round(1.0*x/y * Math.pow(10,n)) ;
	//alert(f);
	return (f >= 0 && (f != "Infinity") && !f.NaN) ? (f < 100 ? '<font color="red">' + f + "%" : f + "%") : '';
}
function leftDecIgnoreZeroWithPercentAndNoRed(x,y,n) {
	if(y==0){
		return '';
	}
	var f = Math.round(1.0*x/y * Math.pow(10,n)) ;
	//alert(f);
	return (f >= 0 && (f != "Infinity") && !f.NaN ) ? f + "%":'';
}
//在括号内显示百分数
function leftDecIgnoreZeroWithPercentAndBracket(x,y,n) {
	if(y==0){
		return '';
	}
	var f = Math.round(1.0*x/y * Math.pow(10,n)) ;
	return (f >= 0 && (f != "Infinity") && !f.NaN) ? (f < 100 ? '<font color="red">(' + f + "%)" : "(" + f + "%)") : '';
}
function addNullData(data){		
		var s=""+data;		
		if(0<data.length && data.length<12){
			for(var initMon=data.length;initMon<12;initMon++){
				s+=",'null'";
			}
			return eval("["+s+"]");			
		}else if(0==data.length){
			for(var initMon=data.length;initMon<12;initMon++){
				s+="'null',";
			}
			return eval("["+s.substr(0,s.length-1)+"]");
		}
		return eval("["+s+"]");			
	}